#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
int path[30];
int n, cho;
void dfs(int depth, int start)
{
	if (n - start < cho - depth)
	{
		return;
	}
	if (depth > cho)
	{
		for (int i = 1; i <= cho; i++)
		{
			printf("%d ", path[i]);
		}
		printf("\n");
		return;
	}
	for (int i = start;i<=n;i++)
	{
		path[depth] = i;
		dfs(depth + 1, i + 1);
	}
}
int main()
{
	scanf("%d %d", &n, &cho);
	dfs(1, 1);
	return 0;
}